<template>
  <div>
    <input
    type="text"
    :placeholder="placeholder"
    v-model="keyword"
    :class="['searchInput', 'layui-input', hasIcon && 'icon-search']"/>
  </div>
</template>
<script>
export default {
  name: 'search',
  data() {
    return {
      keyword: ''
    }
  },
  props: {
    placeholder: {
      type: String,
      default: '请输入搜索关键词'
    },
    hasIcon: {
      type: Boolean,
      default: true
    }
  },
  watch: {
    keyword(val) {
      this.$emit('change', val)
    }
  }
}
</script>
